package com.zly.demo.rediscache.service;

import com.zly.demo.rediscache.annotation.RedisCache;
import com.zly.demo.rediscache.entity.User;
import com.zly.demo.rediscache.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    @RedisCache(prefix = "user:", matchPattern = "#id")
    public User getUserById(Long id) {
        return userMapper.getUserById(id);
    }
}
